package test;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

import mapreduce.ReduceTaskConf;
import mapreduce.Reducer;

public class wordreducer extends Reducer<String,Integer,String,Integer>{
	@Override
	protected void reduce(String key, Collection<Integer> values,
			ReduceTaskConf<String,Integer,String,Integer> conf) {
		int sum=0;
		Iterator<Integer> iterator =values.iterator();
		while (iterator.hasNext()) {
			sum+= iterator.next();
			
		}
		
		try {
			
			conf.write(key, sum);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
